package com.shell.governor.organization.service.impl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.springframework.stereotype.Service;

import com.shell.bee.base.utils.StringUtil;
import com.shell.bee.persistence.service.impl.PersistentServiceImpl;
import com.shell.governor.organization.po.PubOrganType;
import com.shell.governor.organization.service.PubOrganTypeService;

import tk.mybatis.mapper.entity.Example;

@Service
public class PubOrganTypeServiceImpl extends PersistentServiceImpl<PubOrganType> implements PubOrganTypeService {
	public List<PubOrganType> getOrganType(String organTypes) {
		Example example = new Example(PubOrganType.class);
		Example.Criteria criteria = example.createCriteria();
		criteria.andEqualTo("typeState", "1");
		if (StringUtil.notTrimEmpty(organTypes)) {
			String[] ots = organTypes.split(",");
			List<Object> list = new ArrayList<Object>();
			Collections.addAll(list, ots);
			criteria.andIn("organType", list);
		}
		return selectByExample(example);
	}
}
